<script setup>
import { onMounted } from 'vue'
import { fabric } from 'fabric'
onMounted(() => {
  const canvas = new fabric.Canvas('canvas', { width: 1200, height: 800 });
  const text = new fabric.IText('Hello World', { // 生成一个helloword的文字
    left: 100, // 位置设置
    top: 100,
    fontFamily: 'Arial', // 字体设置
    fontSize: 24,
    fill: 'black', // 填充颜色
    editable: true // 是否可以编辑
  });
  canvas.add(text); // 添加到canvas
});

</script>

<template>
  <canvas id="canvas"></canvas>
</template>

<style scoped>
#canvas {
  margin: 10px;
  border: 1px solid #d3d3d3;
}
</style>